package com.autonavi.yunda.yunji.core.vo.response;

import java.util.List;
import java.util.stream.Collectors;
import com.autonavi.yunda.yunji.core.model.dto.DatasourceConfigDTO;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author sunzhenbang
 */
@Data
@NoArgsConstructor
public class DataSourcePageVO {
    private List<DataSourceVO> dataSourceConfigList;
    private Long total;
    public DataSourcePageVO(List<DatasourceConfigDTO> datasourceConfigDTOList, long total){
        this.dataSourceConfigList = datasourceConfigDTOList.stream().map(dto -> DataSourceVO.builder().id(dto.getId())
            .dbname(dto.getDbname()).type(dto.getType()).description(dto.getDescription()).config(dto.getConfig()).createUser(dto.getCreateUser())
            .updateUser(dto.getUpdateUser()).createTime(dto.getCreateTime()).updateTime(dto.getUpdateTime()).build()).collect(Collectors.toList());
        this.total = total;
    }
}
